<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="upf" uri="/WEB-INF/tld/frm/dictManage.tld"%>
<!DOCTYPE html>
<html lang="en">
  <head>
    <%@ include file="/WEB-INF/jsp/common/common.jsp" %>
    <link href="${prcs}/css/def/ztree/metro.css" rel="stylesheet">
    <link href="${prcs}/css/def/bootstrap/ace/ace-part2.min.css" rel="stylesheet">
    <link href="${prcs}/css/def/bootstrap/ace/ace.css" rel="stylesheet">
    <link href="${prcs}/css/def/bootstrap/ace/ace-ie.min.css" rel="stylesheet">
    <link href="${prcs}/css/def/frm/common/common.css" rel="stylesheet">
  </head>
    <script type="text/javascript">
         var hadPermission = {'update':false,'del':false,'search':false,'dpmanage':false};
         <shiro:hasPermission name="sys:staff:jfupdate">
         hadPermission.update =true;
         </shiro:hasPermission>
         <shiro:hasPermission name="sys:staff:jfdelete">
         hadPermission.del = true;
         </shiro:hasPermission>
         <shiro:hasPermission name="sys:staff:singlesearch">
         hadPermission.search = true;
         </shiro:hasPermission>
         <shiro:hasPermission name="sys:dp:manage">
         hadPermission.dpmanage = true;
         </shiro:hasPermission>
         var treeArray = ${treeRootArray};
         var varStaffKind = '${staffKind}';
         var disId = '${disId}';
    </script>
    <style>
    	.dataTables_info{
    		float:left;
    	}
    </style>
  <body>
	<input type="hidden" name="currentStaffKind" id="currentStaffKind" value="${staffKind }">
	<div class="head-title staffList">
		<c:if test="${ staffKind == '1'}"><span>甲方人员管理</span></c:if>
		<c:if test="${ staffKind == '2'}"><span>乙方人员管理</span></c:if>
	</div>
 <!-- 人员列表展示开始 -->
	<div id="myTabContent" class="tab-content staffList">
		<div class="tab-pane fade in active" id="home">
			<div class="container-fluid staffDataTable" id="staffSearch" style="padding-top: 20px;">
				<form action="" autocomplete="off">
					<div class="row">
						<div class="input-group col-sm-3 free-3">
							<span class="input-group-addon">人员姓名</span> <input type="text" class="form-control" id="searchStaffName" placeholder="人员姓名" maxlength="20">
						</div>
						<div class="input-group col-sm-3 free-3">
							<span class="input-group-addon">人员账号</span> <input type="text" class="form-control" id="searchLoginName" placeholder="人员账号" maxlength="20">
						</div>
						<div class="input-group col-sm-3 free-3">
							<span class="input-group-addon">岗位状态</span><!--  <select class="form-control" id="searchStaffOrgStatus" data-placeholder="人员状态">
								<option value="" selected="selected">--请选择--</option>
								<option value="1">有效</option>
								<option value="0">无效</option>
							</select> -->
							<upf:dictManage dictId="90120" id="searchStaffOrgStatus" name="personStatus" style="form-control" placeholder="人员状态"/>
						</div>
						<c:if test="${ staffKind == '1'}">
						<div class="input-group col-sm-3 free-3">
							<span class="input-group-addon">所属组织</span> 
							<input type="text" class="form-control" id="searchOrgName" onclick="showOrgTreeForHome()"
								placeholder="所属组织" onfocus="javascript:this.blur();" > 
							<input type="hidden" id="searchOrgId" name="searchOrgId">
						</div>
						</c:if>
						<c:if test="${ staffKind == '2'}">
						<div class="input-group col-sm-3 free-3">
							<span class="input-group-addon">所属组织</span>
							<input type="text" class="form-control" id="searchPartnerOrgName"
								onclick="showOrgTreeForPartner('${disId}','yourOrgFun')" placeholder="所属组织" onfocus="javascript:this.blur();" >
							<input type="hidden" id="searchPartnerOrgId" name="searchPartnerOrgId">
						</div>
						</c:if>
						<div class="div-button col-sm-pull-3">
							<c:if test="${ staffKind == '1'}">
						    <shiro:hasPermission name="sys:dp:save">
							<a href="../dataPermissionController/sysMassDpToStaff" target="_blank" id="addDP" class="btn btn-info" >
								<i class="ace-icon glyphicon glyphicon-search"></i>数据权限批量授权
							</a>
					       </shiro:hasPermission>
					       </c:if>
							<shiro:hasPermission name="sys:staff:search">
								<button type="button" id="searchHome" class="btn btn-info" onclick="search4Page();">
									<i class="ace-icon glyphicon glyphicon-search"></i>查询
								</button>
								<button type="reset" class="btn btn-info">
									<i class="ace-icon glyphicon glyphicon-refresh"></i>重置
								</button>
							</shiro:hasPermission>
							<shiro:hasPermission name="sys:staff:add">
								<button type="button" class="btn btn-success" onclick="showAddPage();">
									<i class="ace-icon glyphicon glyphicon-plus align-top bigger-125"></i>新增
								</button>
							</shiro:hasPermission>
						</div>
					</div>
				</form>
                <hr/>
				<div class="row">
					<table id="searchTable" class="display table table-bordered" width="100%"></table>
				</div>
			</div>
		</div>
	</div>
	 <!-- 人员列表展示结束 -->

	<!-- 添加修改 -->
	<div class="container-fluid staffUpdate" id="staffContainer" style="display: none">
		<!-- <div class="modal fade" id="staffContainer" tabindex="-1" role="dialog" aria-labelledby="staffContainer_label"> -->
			<form id="sysStaffObjectForm" role="form" autocomplete="off">
				<div class="orderchek-border">
					<div class="orderchek-title">人员信息</div>
					<div class="ordercheck-table table-responsive">
						<div class="demo-row" id="staffField">
							<input type="hidden" name="staffId" id="idStaffObj" value=""> 
							<input type="hidden" name="staffKind" id="staffKindStaffObj" value="">  
							<input type="hidden" id="disId" name="disId" value="">
							<input type="hidden" id="StaffOrgType" name="staffOrgType" value="F">
							<div class="row">
								<div class="form-group col-sm-6">
									<div class="input-group">
										<span class="input-group-addon">账号<span class="notNull">*</span></span> <input type="text" name="loginName" class="form-control"
											id="loginNameStaffObj" placeholder="账号">
									</div>
								</div>
								<div class="form-group col-sm-6">
									<div class="input-group">
										<span class="input-group-addon">密码<span class="notNull">*</span></span> 
										<input type="password" name="passwd" class="form-control" id="passwdStaffObj" placeholder="密码">
									</div>
								</div>
							</div>
							<div class="form-group col-sm-6" style="display: none">
								<label class="col-sm-3 control-label no-padding-right" for="staffCodeStaffObj">人员编码</label> <input type="text" name="staffCode"
									id="staffCodeStaffObj" placeholder="人员编码" class="col-xs-10 col-sm-5 form-control">
							</div>
							<div class="row">
								<div class="form-group col-sm-6">
									<div class="input-group">
										<span class="input-group-addon">人员姓名<span class="notNull">*</span></span> 
										<input type="text" name="staffName" class="form-control" id="staffNameStaffObj" placeholder="人员姓名">
									</div>
								</div>
								<div class="form-group col-sm-6">
									<div class="input-group">
										<span class="input-group-addon">所属组织<span class="notNull">*</span></span> 
										<input type="text" name="orgName" class="form-control" id="orgName" onclick="selectTree('yourOrgFun');" onfocus="javascript:this.blur();" placeholder="所属组织"> 
										<input type="hidden" name="orgId" id="orgId">
									</div>
								</div>
							</div>
							<div class="row">
								<div class="form-group col-sm-6">
									<div class="input-group">
										<span class="input-group-addon">显示顺序</span> 
										<input type="text" name="staffSort" class="form-control" id="staffSortStaffObj" placeholder="显示顺序">
									</div>
								</div>
								<div class="form-group col-sm-6">
									<div class="input-group">
										<span class="input-group-addon">身份证号</span> 
										<input type="text" name="empCode" class="form-control" id="empCodeStaffObj" placeholder="身份证号">
									</div>
								</div>
							</div>
							<div class="row">
								<div class="form-group col-sm-6">
									<div class="input-group">
										<span class="input-group-addon">性别</span> <select class="form-control" name="sex" id="sexStaffObj" data-placeholder="性别">
											<option value="M">男</option>
											<option value="W">女</option>
										</select>
									</div>
								</div>
								<div class="form-group col-sm-6">
									<div class="input-group">
										<span class="input-group-addon">入职日期</span> 
										<input type="text" name="hireDate" id="hireDateStaffObj" placeholder="入职日期"
											onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="form-control" readonly="readonly">
									</div>
								</div>
							</div>
							<div class="row">
								<div class="form-group col-sm-6">
									<div class="input-group">
										<span class="input-group-addon">邮政编码</span> 
										<input type="text" name="postcode" id="postcodeStaffObj" placeholder="邮政编码"
											class="form-control">
									</div>
								</div>
								<div class="form-group col-sm-6">
									<div class="input-group">
										<span class="input-group-addon">通信地址</span> 
										<input type="text" name="mailAddr" id="mailAddrStaffObj" placeholder="通信地址"
											class="form-control">
									</div>
								</div>
							</div>
							<div class="row">
								<div class="form-group col-sm-6">
									<div class="input-group">
										<span class="input-group-addon">电话号码</span> 
										<input type="text" name="phone" id="phoneStaffObj" placeholder="电话号码"
											class="form-control">
									</div>
								</div>
								<div class="form-group col-sm-6">
									<div class="input-group">
										<span class="input-group-addon">邮箱号码</span> 
										<input type="text" name="email" id="emailStaffObj" placeholder="邮箱"
											class="form-control">
									</div>
								</div>
							</div>
							<div class="row">
								<div class="form-group col-sm-6">
									<div class="input-group">
										<span class="input-group-addon">手机号码<span class="notNull">*</span></span> 
										<input type="text" name="mobilPhone"
											id="mobilPhoneStaffObj" placeholder="手机号码" class="form-control">
									</div>
								</div>
								<div class="form-group col-sm-6" id="statusStaffObjdiv" style="display: none">
									<div class="input-group">
										<span class="input-group-addon">岗位状态</span> 
										<select class="form-control" name="staffStatus" id="staffStatusStaffObj"
											data-placeholder="岗位状态">
											<option value="1" id="using">有效</option>
											<option value="0" id="unusing">无效</option>
										</select>
									</div>
								</div>
							</div>
							<div class="row">
								<div align="center">
									<button class="btn btn-primary" type="submit" id="saveBtn" style="display: none">
										<i class="ace-icon fa fa-check bigger-110"></i> 保存
									</button>
									<button class="btn btn-primary" type="submit" id="updateBtn" style="display: none">
										<i class="ace-icon fa fa-check bigger-110"></i> 修改
									</button>
									<button class="btn btn-primary" type="button" id="backBtn" data-dismiss="modal" onclick="showList()">
										<i class="ace-icon fa fa-check bigger-110"></i> 返 回
									</button>
								</div>
							</div>
						</div>
					</div>
				</div>
			</form>
		
	</div>
	<!-- 组织树 开始-->
	<div id="faDIV" style="display: none; position: absolute; background-color: white; border: 1px solid #3aa5ff; z-index: 1052;">
		<ul id="orgTree" class="ztree" style="max-height: 320px; overflow-x: hidden; overflow-y: auto;"></ul>
	</div>
	<div id="searchHomeOrgDIV" style="display: none; position: absolute; background-color: white; border: 1px solid #3aa5ff; z-index: 1052;">
		<ul id="orgHomeTree" class="ztree" style="max-height: 360px; overflow-x: hidden; overflow-y: auto;"></ul>
	</div>
	<div id="searchPartnerOrgDIV" style="display: none; position: absolute; background-color: white; border: 1px solid #3aa5ff; z-index: 1052;">
		<ul id="orgPartnerTree" class="ztree" style="max-height: 360px; overflow-x: hidden; overflow-y: auto;"></ul>
	</div>
    <!-- 组织树 结束-->
	<!-- 人员信息模态框 开始 -->
	<div class="modal fade" id="infoModal" tabindex="-1" role="dialog" aria-labelledby="infoModal_label">
		<div class="modal-dialog" style="min-width: 800px;">
			<div class="modal-content">
	            <div class="modal-header">
	                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
	                    <span aria-hidden="true">&times;</span>
	                </button>
	                <h4 class="modal-title">人员基本信息</h4>
	            </div>
				<div>
					<iframe id="jump_url" width="100%" height="100%" src="" style="min-height: 360px;"></iframe>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-primary" data-dismiss="modal">关闭</button>
				</div>
			</div>
		</div>
	</div>
	<!-- 人员信息模态框 结束 -->
    <!-- 角色关联div 开始 -->
	<div id="rolesModal" class="roleSetting" tabindex="-1" role="dialog" aria-labelledby="rolesModal_label"
		style="display: none; width: 100%; height: 100%;">
		<div class="orderchek-body-row">
			<div class="orderchek-border">
				<div class="orderchek-title">
					<span id="selectedStaffOrg"></span>岗位角色管理
				</div>
				<input type="hidden" id="selectedStaffRoleId">
				<div class="ordercheck-table table-responsive">
					<div class="demo-row">
						<div class="col-xs-5">
							<h5>待选角色</h5>
							<select name="from[]" id="notHavingRoles" class="form-control" size="9" style="height:200px;" multiple="multiple"></select>
						</div>
						<div class="col-xs-2">
							<h5>&nbsp;</h5>
							<button type="button" id="rightAll" class="btn btn-info btn-block">
								<i class="glyphicon glyphicon-forward"></i>
							</button>
							<button type="button" id="rightSelected" class="btn btn-info btn-block">
								<i class="glyphicon glyphicon-chevron-right"></i>
							</button>
							<button type="button" id="leftSelected" class="btn btn-info btn-block">
								<i class="glyphicon glyphicon-chevron-left"></i>
							</button>
							<button type="button" id="leftAll" class="btn btn-info btn-block">
								<i class="glyphicon glyphicon-backward"></i>
							</button>
							<button type="button" id="notHavingRoles_undo" class="btn btn-block">撤销</button>
						</div>
						<div class="col-xs-5">
							<h5>已有角色</h5>
							<select name="to[]" id="hadRoles" class="form-control" size="9" style="height:200px;"  multiple="multiple"></select>
						</div>
					</div>
				</div>
					<div align="center" style="padding-top:10px;">
						<button class="btn btn-primary" type="button" id="saveRoleBtn" onclick="javascript:doSaveRoles();">保存设置</button>
						<button type="button" class="btn btn-primary" data-dismiss="modal" onclick="javascript:showList()">取消</button>
					</div>
			</div>
		</div>
	</div>
	<!-- 角色关联div 结束 -->
	<!-- 岗位关联div -->
	<div class="container-fluid" id="orgContainer" style="display:none;">
		<div id="orgManageTitle" style="margin:0px 0px 0px 0px;font-size:16px; color:#ca5952;"></div>
		<div class="row">
			<div class="float-btn">
				<button type="button" class="btn btn-success" id="addOrg" onclick="showOrgAddPage();">
					<i class="ace-icon glyphicon glyphicon-plus align-top bigger-125"></i>新增
				</button>
				<a type="button"  class="btn btn-info" id="closeAddModal" onclick="showList();">返回</a>
				<input type="hidden" name="staffId" id="staffId" >
			</div>
		</div>
			<hr>
		<div class="row">
			<!-- 列表 -->
			<table id="searchOrgTable" class="display table table-bordered" cellspacing="0" width="100%">
				<thead>
					<tr>
						<th></th>
						<th>操作</th>
						<th>岗位类型</th>
						<th>组织名称</th>
						<th>在职状态</th>	
						<th>入职日期</th>
						<th>生效日期</th>
						<th>结束日期</th>
						<th>职责</th>	
					</tr>
				</thead>
				<tbody></tbody>
			</table>
		</div>
	</div>	
	<!-- 岗位关联div 结束-->
	<!-- 人员岗位操作  新增修改岗位信息 -->
	<div class="container-fluid " id="orgOperation" style="display:none;">
		<form  class="form-horizontal" role="form" id="orgForm">
			<div class="orderchek-border">
		        <div id="orgOperationTitle" class="orderchek-title"></div> 
				<div class="ordercheck-table table-responsive">
					<div class="demo-row modal-body" id="orgField" >
						<input type="hidden" name="staffId" id="staffOrgFormId" >
						<input type="hidden" name="staffOrgId" id="staffOrgId" >
						<input type="hidden" name="orgType" id="orgType">
						<div class="col-sm-12">
							<div class="form-group col-sm-6">
								<div class="input-group">
									<span class="input-group-addon">岗位类型<span class="notNull">*</span></span> 
									<select class="form-control" style="display:none;" name="staffOrgType" id="staffOrgType" data-placeholder="岗位类型">
										<option value="T" id="parttime">兼职</option>
										<option value="J" id="transfer">借调</option>
									</select>
									<input class="form-control" id="staffOrgTypeForMajor" name="staffOrgTypeForMajor" value= "主岗"style="display:none;" readonly>
								</div>
							</div>
							<div class="form-group col-sm-6">
								<div class="input-group">
									<span class="input-group-addon">组织名称<span class="notNull">*</span></span> <input type="text" name="staffOrgName" class="form-control" data-toggle="modal" data-target="#orgModal"
			      				id="staffOrgName" readonly="readonly">
			      				<input type="hidden" name="orgId" id="staffOrgOrgId" >
								</div>
							</div>
						</div>
						<div class="col-sm-12">
							<div class="form-group col-sm-6">
								<div class="input-group">
									<span class="input-group-addon">入职日期</span> <input type="text" name="hireDate" id="staffOrgHireDate" placeholder="入职日期"
										onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="form-control" readonly="readonly">
								</div>
							</div>
							<div class="form-group col-sm-6">
								<div class="input-group">
									<span class="input-group-addon">生效日期</span> <input type="text" name="effectStartDate" id="staffOrgStartDate" placeholder="生效日期"
										onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="form-control" readonly="readonly" >
								</div>
							</div>
						</div>
						<div class="col-sm-12">
							<div class="form-group col-sm-6">
								<div class="input-group">
									<span class="input-group-addon">结束日期</span> <input type="text" name="effectEndDate" id="staffOrgEndDate" placeholder="结束日期"
										onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="form-control" readonly="readonly">
								</div>
							</div>
							<div class="form-group col-sm-6">
								<div class="input-group">
									<span class="input-group-addon">在职状态<span class="notNull">*</span></span> <select class="form-control" style="display:none;" name="staffOrgStatus" id="staffOrgStatus" data-placeholder="在职状态">
										<option value="1" id="inUse">有效</option>
										<option value="0" id="outOfUse">无效</option>
									</select>
									<input class="form-control" id="staffOrgStatus1" name="staffOrgStatus1" value="有效" style="display:none;" readonly="readonly">
								</div>
							</div>
						</div>
						<div class="col-sm-12">
							<div class="form-group col-sm-12">
								<div class="input-group">
									<span class="input-group-addon">职责</span> <input type="text" name="duty"
											id="duty" placeholder="职责" class="form-control">
								</div>
							</div>
						</div>
			    		<div align="center">                                                                
			       			<button type="submit" class="btn btn-primary ma_btn2" name="addBtnName" style="display:none" id="addOrgBtn">保存</button>
							<button type="submit" class="btn btn-primary ma_btn3" name="updateBtnName" style="display:none" id="updateOrgBtn">修改</button>
							<button type="button" class="btn btn-primary"  onclick="showOrg();">返回</button>        
			      		</div>  
			    	</div>
				</div>
			</div>
		</form>
	</div>
	<!-- 人员岗位操作  新增修改岗位信息  结束 -->
	<!-- 组织机构信息模态框  开始 -->
	<div class="modal fade" id="orgModal" tabindex="-1" role="dialog" aria-labelledby="orgModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title" id="orgModalLabel">组织机构信息</h4>
				</div>
				<div class="modal-body">
					<ul id="staffOrgTree" class="ztree" style="width:560px; overflow:auto;"></ul>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal" id="staffOrgCloseModal">关闭</button>
				</div>
			</div>
		</div>
	</div>
	<!-- 组织机构信息模态框  结束 -->
		<!-- 合作方组织列表 -->
		<div class="modal fade" id="NoPermissionModal">
			<div class="modal-dialog" style="width:700px;" >
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal">×</button>
						<h4 class="modal-title" id="NoPermissionModalLabel">乙方组织列表</h4>
					</div>
					<div class="modal-body">
					   	<iframe id="NoPermissioniframe" width="100%" height="500px" frameborder="0" ></iframe>
					</div>
				</div>
			</div>
		</div>
	<!-- 合作方组织列表  结束 -->
</body>
    <script src="${prcs}/js/jquery/plugin/My97DatePicker/WdatePicker.js"></script>
    <script src="${prcs}/js/jquery/plugin/jquery.ztree.all-3.5.min.js"></script>
    <script src="${prcs}/js/jquery/plugin/multiselect/multiselect.min.js"></script>
    <script src="${prcs}/js/frm/sys/sysSingleStaffMain.js"></script>
    <script src="${prcs}/js/frm/sys/staffList.js"></script>
</html>
